
<?php
	require("../../DBops.php");
	session_start();
	$con = connect("localhost", "root", "", "lab");
	//$ID=$_GET["ID"];
	$name=  $_GET["name"];
	$intro=  $_GET["intro"];
	
	if(!$name || $name == '')
	{
		echo "<script>alert(\"name不能为空~~\");</script>";
		echo"<script>location.href='Team_index.php'</script>";
		die(0);
	}

	$result =mysql_query("select name from projecteam ");
	while($row=mysql_fetch_array($result)){
		if($name==$row['name']){
			echo "<script>alert(\"该name已存在,请更换~~\");</script>";
			echo"<script>location.href='Team_index.php'</script>";
			die(0);
		}
	}
	//$row = mysql_fetch_array($result);

	//$data = array($name, $intro);
	//insertIntoDB($con, "projecteam", $data);
	$sql = "INSERT INTO projecteam(`name`, introduction) VALUES('".$name."', '".$intro."')";
	//echo $sql."<br />";
	mysql_query($sql, $con);
	echo"<script>location.replace(\"Team_index.php\");</script>";


?>